<template>
  <view>
    <course-or-clazz-obj v-if="isShow" :is-course="type" :is-scan="true" :course="course"/>
  </view>
</template>

<script>
import CourseOrClazzObj from "../../components/course_or_clazz_obj/course_or_clazz_obj";
export default {
  components: {CourseOrClazzObj},
  data() {
    return {
      course: {},
      type: false,
      isShow: false
    };
  },
  onLoad(e) {
    uni.$emit("setVuexUserInfo",{user:null,isLoginPage: false});
    let id = e.id;
    if (e.type === "course") {
      this.type = true;
      this.$u.api.getCourseById(id).then(res => {
        this.course = res.data;
        this.isShow = true;
      })
    }else {
      this.type = false;
      this.$u.api.getClazzVoById(id).then(res => {
        this.course = res.data;
        this.isShow = true;
      })
    }
  },
  methods: {

  }
}
</script>

<style lang="scss">

</style>
